package org.lqq.remoteClient;

import feign.Feign;
import feign.jackson.JacksonDecoder;
import feign.jackson.JacksonEncoder;
import org.lqq.loadbalance.LoadBalancer;
import org.lqq.serverRegisterAndFinder.serverFinder.ServerFinder;


/**
 * Created by 李清泉 on 2017/10/26.
 *
 * @remark
 */
public class FeignRemoteClient extends AbstractRemoteClient {


    public FeignRemoteClient(ServerFinder serverFinder, LoadBalancer loadBalancer) {
        super(serverFinder, loadBalancer);
    }


    @Override
    protected <T> T doGetRemoteObject(Class<T> clazz, String url) {
        return Feign.builder().encoder(new JacksonEncoder()).decoder(new JacksonDecoder()).target(clazz, url);
    }
}
